<?php

/**
 * PHP Captcha Form Validator
 *
 * @package    sfPHPCaptchaPlugin
 * @subpackage form
 * @author     Sven Wappler <info@wapplersystems.de>
 */
class sfValidatorMyCaptcha extends sfValidatorBase {


    protected function configure($options = array(), $messages = array()) {
        parent::configure($options, $messages);
    }

    protected function doClean($value) {
        //ini_set('include_path',ini_get('include_path').';'.sfConfig::get('sf_plugins_dir').'/sfMyCaptchaPlugin/ext-lib');
        //require_once('securimage.php');
        $img = new Securimage();
        $valid = $img->check($value);
        
        
        if(!$valid){

            throw new sfValidatorError($this, 'invalid', array('value' => $value));
        }else{
            return true;
        }


    }

}

